#include "jokerwinningnumberfield.h"
#include <QtGui>

JokerWinningNumberField::JokerWinningNumberField(QWidget *parent) :
    QLineEdit(parent)
{
    QRegExp regexp("([0-9])");
    this->setValidator(new QRegExpValidator(regexp, this));

    connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkIfValid(QString)));
}

void JokerWinningNumberField::checkIfValid(QString numberInField)
{
    if (numberInField.toInt() > 9) {
        this->setStyleSheet("QLineEdit {background-color: red;}");
    }
    else {
        this->setStyleSheet("QLineEdit {background-color: white;}");
    }
}
